// src/utils/permission.js
import { useAuthStore } from '@/stores/auth'

/**
 * 检查是否有权限
 */
export function hasPermission(permission) {
  const authStore = useAuthStore()
  return authStore.hasPermission(permission)
}

/**
 * 检查是否有任一权限
 */
export function hasAnyPermission(permissions) {
  const authStore = useAuthStore()
  return authStore.hasAnyPermission(permissions)
}

/**
 * 检查是否有所有权限
 */
export function hasAllPermissions(permissions) {
  const authStore = useAuthStore()
  return authStore.hasAllPermissions(permissions)
}

/**
 * 检查是否有角色
 */
export function hasRole(role) {
  const authStore = useAuthStore()
  return authStore.hasRole(role)
}

/**
 * 检查是否有任一角色
 */
export function hasAnyRole(roles) {
  const authStore = useAuthStore()
  return authStore.hasAnyRole(roles)
}